using IceCS.NSubstitute.Core;
using NSubstitute;
using System;
using Xunit;

namespace IceCS.NSubstitute.xUnitTest
{
    public class UnitTest1
    {
        [Fact]
        public void Test1()
        {
            //Create:
            var calculator = Substitute.For<ICalculator>();

            //Set a return value:
            calculator.Add(1, 2).Returns(3);
            Assert.Equal(3, calculator.Add(1, 2));

            calculator.Add(2, 2);
            calculator.Add(2, 2);
            calculator.Add(2, 2);

            //Check received calls:
            calculator.Received().Add(1, Arg.Any<int>());
            calculator.DidNotReceive().Add(2, 2);

            //Raise events
            calculator.PoweringUp += Raise.Event();
        }
    }
}
